A unified treatment of syntax with binders

نویسندگان

  • Nicolas Pouillard
  • François Pottier
چکیده

Atoms and de Bruijn indices are two well-known representation techniques for data structures that involve names and binders. However, using either technique, it is all too easy to make a programming error that causes one name to be used where another was intended. We propose an abstract interface to names and binders that rules out many of these errors. This interface is implemented as a library in Agda. It allows defining and manipulating term representations in nominal style and in de Bruijn style. The programmer is not forced to choose between these styles: on the contrary, the library allows using both styles in the same program, if desired. Whereas indexing the types of names and terms with a natural number is a well-known technique to better control the use of de Bruijn indices, we index types with worlds. Worlds are at the same time more precise and more abstract than natural numbers. Via logical relations and parametricity, we are able to demonstrate in what sense our library is safe, and to obtain theorems for free about world-polymorphic functions. For instance, we prove that a world-polymorphic term transformation function must commute with any renaming of the free variables. The proof is entirely carried out in Agda.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Comparison the Effectiveness of “Cognitive Behavioral Treatment” and “Unified Trans diagnostic Treatment” on Emotional Expression and Fear of Intimacy in Children of Divorce

Introduction: Divorce exposes adolescent children to severe physical, emotional, and social crises. Methods of reducing health-related problems include “Cognitive Behavioral Treatment” and “Unified Trans Diagnostic Treatment”. Therefore, the present study aimed to compare the effectiveness of “Cognitive Behavioral Treatment” and “Unified Trans Diagnostic Treatment” on emotional expression and f...

متن کامل

Hierarchical Nominal Terms and Their Theory of Rewriting

Nominal rewriting introduced a novel method of specifying rewriting on syntax-with-binding. We extend this treatment of rewriting with hierarchy of variables representing increasingly ‘meta-level’ variables, e.g. in hierarchical nominal term rewriting the meta-level unknowns (representing unknown terms) in a rewrite rule can be ‘folded into’ the syntax itself (and rewritten). To the extent that...

متن کامل

An Open Challenge Problem Repository for Systems Supporting Binders

A variety of logical frameworks support the use of higher-order abstract syntax in representing formal systems; however, each system has its own set of benchmarks. Even worse, general proof assistants that provide special libraries for dealing with binders offer a very limited evaluation of such libraries, and the examples given often do not exercise and stress-test key aspects that arise in th...

متن کامل

INBOUND: Simple yet powerful Specification of Syntax with Binders

Nearly all meta-programming tools need to deal with binders in abstract syntax trees. Unfortunately, ubiquitous boilerplate functions for computing free variables and variable substitution are remarkably intricate and hard to get right. Moreover, the complexity quickly increases with larger languages and non-trivial binding forms. On top of that, the underlying scoping rules are only implicitly...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • J. Funct. Program.

دوره 22  شماره 

صفحات  -

تاریخ انتشار 2012